﻿@model UcAsp.Models.Articles
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>内容管理</title>
    <script type="text/javascript">

        tinymce.init({
            selector: "textarea",
            plugins: [
                "advlist autolink lists link image charmap print preview anchor",
                "searchreplace visualblocks code fullscreen",
                "insertdatetime media table contextmenu paste hr upfile"
            ],
            toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent |link image upfile"

        });
        $(document).ready(function () {
            //$(".editadv").click(function () {
            //    $.post("/admin/GetAdvPostion", { AdvName: $(this).attr("data-id") }, function (dataresult) {
            //        $.facebox(dataresult, "ucaspfacebox");
            //    })
            //});
            $("#savecontent").click(function () {
                $.ajaxFileUpload
                           (
                               {
                                   url: '/Admin/UpFile?Path=content',
                                   secureuri: false,
                                   fileElementId: 'FileImageUrl',
                                   dataType: 'json',
                                   success: function (data, status) {
                                       if (typeof (data.error) != 'undefined') {
                                           if (data.error != '') {
                                               alert(data.error);
                                           } else {

                                               $.post("/ContentManager/SaveContent",
                                               { ID: $("input[name='ID']").val(), Title: $("input[name='Title']").val(), Rate: $("input[name='Rate']").val(), IconUrl: data.msg, Tag: $("input[name='Tag']").val(), MetaKeyword: $("input[name='MetaKeyword']").val(), MetaDescrition: $("input[name='MetaDescrition']").val(), Description: $("input[name='Description']").val(), Description: $("input[name='Description']").val(), ArticleContent: tinyMCE.get("ArticleContent").getContent(), CategorieID: $("select[name='CategorieID']").val() },
                                               function (dataBack) {
                                                   if (dataBack.Result) {                                                      
                                                       location.href = "/contentmanager/Index";
                                                   }
                                               });


                                           }
                                       }
                                   },
                                   error: function (data, status, e) {
                                       alert(e);
                                   }
                               }
                           )




            })
        })

</script>
</head>
<body>
    <form action="#" method="post">
    <div>
        <input name="ID" type="hidden" value="@Model.ID" />
        <p>
              <label>文章标题</label>
              <input class="text-input medium-input" type="text" id="Title" name="Title" value="@Model.Title" />
        </p>
        <p>
            <label>分类选择</label>
        @Html.DropDownListFor(m=>m.CategorieID, (SelectList)ViewData["selectlist"])
            </p>
       <p>
              <label>TAG</label>
              <input class="text-input large-input" type="text" id="large-input" name="Tag" value="@Model.Tag" />
        </p>
        <p>
              <label>图片</label>
              <img alt="" src="@Model.IconUrl" /><input id="FileImageUrl" name="FileImageUrl" type="file" />
        </p>
        <p>
              <label>SEO关键词</label>
              <input class="text-input medium-input" type="text" id="MetaKeyword" name="MetaKeyword" value="@Model.MetaKeyword" />
        </p>
        <p>
              <label>SEO描述</label>
              <input class="text-input medium-input" type="text" id="MetaDescrition" name="MetaDescrition" value="@Model.MetaDescrition" />
        </p>
        <p>
              <label>文章简介</label>
              <input class="text-input large-input" type="text" id="Description" name="Description" value="@Model.Description" />
        </p>
        <p>
              <label>文章内容</label>
            <textarea id="ArticleContent" name="ArticleContent" cols="20" rows="2">@Model.ArticleContent</textarea>
             
        </p>
        <p>
              <label>排序</label>
              <input class="text-input large-input" type="text" id="Rate" name="Rate" value="@Model.Rate" /> 越大越往前
        </p>
        <p> 
               <input class="button" id="savecontent" type="button" value=" 保存 " />
      </p>
    </div>
        </form>
</body>
</html>
